package com.alex.controller;

import com.alex.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RequestMapping("/rest")
@RestController
public class HelloRestController {

    @Resource(name = "user01")
    private User user01;

    @Resource(name = "user02")
    private User user02;

    @RequestMapping("/hello")
    public String handle01() {
        return "hello, spring boot! [rest]";
    }

    @RequestMapping("/test01")
    public String test01() {
        return "<h1>test01</h1>";
    }

    @RequestMapping("/test02")
    public String test02() {
        return "<h1>test02 你好!</h1>";
    }

    @RequestMapping("/test03")
    public Object test03() {
        return user01;
    }

    @RequestMapping("/test04")
    public Object test04() {
        return user02;
    }
}
